package com.molichuxing.gateway.property;

/**
 * 
 * @author liyg
 *
 */
public enum UserTypeEnum {

	/**
	 *用户
	 */
	APP_USER (1, "user"),
	
	/**
	 *用户
	 */
	TERMINAL_USER (2, "user"),
	
	/**
	 *销售顾问用户
	 */
	COUNSELOR_USER (3, "counselor"),
	
	/**
	 *用户
	 */
	WECHAT_USER (4, "wechatUser");





	int value;
	String name;

	UserTypeEnum(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		return name;
	}


	/**
	 * 通过value获取枚举的name
	 * 
	 * @param value
	 * @return
	 */
	public static String getName(int value) {
		UserTypeEnum enumerate = getEnum(value);
		return enumerate == null ? null : enumerate.getName();
	}

	/**
	 * 通过value获取枚举
	 * 
	 * @param value
	 * @return
	 */
	public static UserTypeEnum getEnum(int value) {
		for (UserTypeEnum enumerate : UserTypeEnum.values()) {
			if (enumerate.getValue() == value) {
				return enumerate;
			}
		}
		return null;
	}
}
